In this tutorial we will build simple Spring Boot Application that only has Controller that returns static HTML page.
Application Schema [Results]
Spring Boot Starters
Create Project: controller_application (add Spring Boot Starters from the table)
Create Package: controllers (inside package com.ivoronline.test_spring_boot)
– Create Class: MyController.java (inside package controllers)
Create HTML File: test.html (inside directory resources/templates)
MyController.java
package com.ivoronline.controller_application.controllers;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
@Controller
public class MyController {
@RequestMapping("/Hello")
public String hello() {
System.out.println("Hello from Controller");
return "test";
}
}
test.html
<title>Test.html</title>
Hello from test.html